/*
 * Copyright (c) 2018. czmc All Rights Reserved.
 * Author: czmc
 * Email: zxc6355533@163.com
 * Encoding: UTF-8
 */

package top.stime21.myneighbours.base

import android.os.Bundle
import android.view.View
import me.drakeet.materialdialog.MaterialDialog
import org.greenrobot.eventbus.EventBus
import top.stime21.framework.extension.toActivity
import top.stime21.framework.mvp.MvpContract
import top.stime21.framework.mvp.MvpFragment
import top.stime21.myneighbours.Events
import top.stime21.myneighbours.module.login.LoginActivity

/**
 * Author: czmc  Email: @tuwan21.com
 * Version:	1.0  Date:3/4/2018
 */
 abstract class BuzMvpFragment<P:MvpContract.Presenter>:MvpFragment<P>(){
    override fun onLoginTimeOut() {
        val dialog = MaterialDialog(context).setTitle("")
        dialog.setTitle("温馨提醒")
                .setMessage("登陆令牌已过时，请重新登陆")
                .setPositiveButton("确定", {
                    EventBus.getDefault().post(Events.Logout())
                    context!!.toActivity<LoginActivity>()
                    dialog.dismiss()
                }).setNegativeButton("取消", {
            dialog.dismiss()
        })
        dialog.show()
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
    }


}